<div id="tabs">
<!--
        Column('foto', Boolean, default=False),
        Column('icona_categoria', Text, nullable=True),
        -->


<form class="form-horizontal" role="form" id="ae_form" action="/pg/ac_Categoria/Create" method="post" enctype=multipart/form-data >
<input type="hidden" name="id" value="{{pageData['dao'].id}}"/>
<ul>
    <li><a href="#tabs-1" title="Informazioni principali ed obbligatorie">Dati principali</a></li>
</ul>

<div id="tabs-1">
    <div class="form-group" title="">
        <label class="col-sm-2 col-lg-2 control-label" for="denominazione">Denominazione:</label>
        <div class="col-sm-5 col-lg-5">
            <input class="form-control" type="text" id="denominazione" name="denominazione" value='{{pageData["dao"].denominazione|nonone}}' />
        </div>
    </div>

    <div class="form-group" title="">
        <label class="col-sm-2 col-lg-2 control-label" for="denominazione_breve">Denominazione Breve:</label>
        <div class="col-sm-5 col-lg-5">
            <input class="form-control" type="text" id="denominazione_breve" name="denominazione_breve" value='{{pageData["dao"].denominazione_breve|nonone}}' />
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-2 col-lg-2 control-label" for="id_tipo_categoria" >Tipo di Categoria</label>
        <div class="col-sm-5 col-lg-5">
            <select id="id_tipo_categoria" name="id_tipo_categoria" class="validate[required]">
                <option value=""></option>
                    {% for t in pageData['tipicategorie'] %}
                <option value="{{t.id}}" {{ 'selected="selected"' if t.id == pageData["dao"].id_tipo_categoria}}  >{{t.denominazione}} </option>
                    {% endfor %}
            </select>
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-2 col-lg-2 control-label" for="id_tipo_geo" >Tipo Geo</label>
        <div class="col-sm-5 col-lg-5">
            <select id="id_tipo_geo" name="id_tipo_geo" class="">
                <option value=""></option>
                    {% for t in pageData['tipigeo'] %}
                <option value="{{t.id}}" {{ 'selected="selected"' if t.id == pageData["dao"].id_tipo_geo}}  >{{t.denominazione}} </option>
                    {% endfor %}
            </select>
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-2 col-lg-2 control-label" for="id_licenza" >Tipo Licenza</label>
        <div class="col-sm-5 col-lg-5">
            <select id="id_licenza" name="id_licenza" class="">
                <option value=""></option>
                    {% for t in pageData['licenze'] %}
                <option value="{{t.id}}" {{ 'selected="selected"' if t.id == pageData["dao"].id_licenza}}  >{{t.name}} </option>
                    {% endfor %}
            </select>
        </div>
    </div>

    <div class="form-group">
        <div class="col-sm-5 col-lg-5 col-sm-offset-2">
        <div class="checkbox">
            <label>
                <input class=form-control" type="checkbox" id="foto" name="foto"  {{ "checked" if pageData["dao"].foto == True }} > Foto
            </label>
        </div>
        </div>
   </div>

    <div class="form-group" title="">
        <label class="col-sm-2 col-lg-2 control-label" for="icona_categoria">Icona:</label>
        <div class="col-sm-5 col-lg-5">
                {% if pageData['dao'].icona_categoria %}
            <div class="fileinput fileinput-exists" data-provides="fileinput">
                {% else %}
            <div class="fileinput fileinput-new" data-provides="fileinput">
                {% endif %}
                <div class="fileinput-preview thumbnail" data-trigger="fileinput" style="width: 150px;height:150px;">
                    <img class="img-thumbnail img-responsive" src="data:image/png;base64,{{pageData['dao'].icona_categoria}}" alt="icona"  />
                </div>
                <div>
                    <span class="btn btn-danger btn-file">
                    <span class="fileinput-new">Seleziona</span>
                    <span class="fileinput-exists">Cambia</span>
                        <input class="" type="file" name="icona_categoria" id="icona_categoria">
                    </span>
                        <a href="#" class="btn btn-info fileinput-exists" data-dismiss="fileinput">Rimuovi</a>
                </div>
            </div>
        </div>
    </div>

    <div class="form-group" title="">
        <label class="col-sm-2 col-lg-2 control-label" for="descrizione">Descrizione:</label>
        <div class="col-sm-5 col-lg-5">
            <textarea class="form-control" type="text" id="descrizione "name="descrizione" rows=10" cols="85">{{pageData['dao'].descrizione|nonone}}</textarea>
        </div>
    </div>
           <div class="form-group" title="">
        <label class="col-sm-2 col-lg-2 control-label" for="icona_font">Icona Font Italiacives:</label>
        <div class="col-sm-5 col-lg-5">
            <input class="form-control" type="text" id="icona_font" name="icona_font" value='{{pageData["dao"].icona_font|nonone}}' />
        </div>
    </div>
        <div class="form-group" title="">
        <label class="col-sm-2 col-lg-2 control-label" for="colore_icona_font">Colore icona font:</label>
        <div class="col-sm-5 col-lg-5">
            <input class="form-control" type="text" id="colore_icona_font" name="colore_icona_font" value='{{pageData["dao"].colore_icona_font|nonone}}' />
        </div>
    </div>
    <div class="form-group" title="">
        <label class="col-sm-2 col-lg-2 control-label" for="tagss">Tags:</label>
        <div class="col-sm-5 col-lg-5">
             <input type='hidden' id="tagss" name="tagss" style="width:300px" value="{{pageData['catetags']}}" ></input>
        </div>
    </div>


    <div class="form-group" title="Bottoni di salvataggio e reset del form">
        <div class="col-sm-5 col-lg-5 col-sm-offset-2">
            <input class="btn btn-default" type="submit" value="Salva" name="add"/>
            <input class="btn btn-default" type="button" value="Chiudi" name="chiudi" id="chiudi_edit"/>
        </div>
    </div>

</form>
</div>


<script type="text/javascript">

$(document).ready(function(){
  $("#tagss").select2({tags:["casa", "banane"]});
$("#ae_form").validationEngine();
 $(function() {
$( "#tabs" ).tabs();
});

});
</script>
